package com.luhuiguo.cms.client.gin;

import com.google.inject.Singleton;
import com.luhuiguo.cms.client.place.AppPlaceManager;
import com.luhuiguo.cms.client.presenter.AppPresenter;
import com.luhuiguo.cms.client.presenter.ArticleProxy;
import com.luhuiguo.cms.client.presenter.ArticlesPresenter;
import com.luhuiguo.cms.client.presenter.AttachmentProxy;
import com.luhuiguo.cms.client.presenter.AttachmentsPresenter;
import com.luhuiguo.cms.client.presenter.ChannelsPresenter;
import com.luhuiguo.cms.client.presenter.EditArticlePresenter;
import com.luhuiguo.cms.client.presenter.EditAttachmentPresenter;
import com.luhuiguo.cms.client.presenter.EditChannelPresenter;
import com.luhuiguo.cms.client.presenter.HeaderPresenter;
import com.luhuiguo.cms.client.presenter.MainPresenter;
import com.luhuiguo.cms.client.presenter.NavigationPresenter;
import com.luhuiguo.cms.client.presenter.SettingsPresenter;
import com.luhuiguo.cms.client.ui.AppView;
import com.luhuiguo.cms.client.ui.ArticlesView;
import com.luhuiguo.cms.client.ui.AttachmentsView;
import com.luhuiguo.cms.client.ui.ChannelsView;
import com.luhuiguo.cms.client.ui.EditArticleView;
import com.luhuiguo.cms.client.ui.EditAttachmentView;
import com.luhuiguo.cms.client.ui.EditChannelView;
import com.luhuiguo.cms.client.ui.HeaderView;
import com.luhuiguo.cms.client.ui.MainView;
import com.luhuiguo.cms.client.ui.NavigationView;
import com.luhuiguo.cms.client.ui.SettingsView;
import com.luhuiguo.gwt.presenter.client.DefaultEventBus;
import com.luhuiguo.gwt.presenter.client.EventBus;
import com.luhuiguo.gwt.presenter.client.gin.AbstractPresenterModule;
import com.luhuiguo.gwt.presenter.client.place.ParameterTokenFormatter;
import com.luhuiguo.gwt.presenter.client.place.PlaceManager;
import com.luhuiguo.gwt.presenter.client.place.TokenFormatter;

public class Module extends AbstractPresenterModule {

    @Override
    protected void configure() {
        bind(EventBus.class).to(DefaultEventBus.class).in(Singleton.class);
        bind(TokenFormatter.class).to(ParameterTokenFormatter.class);
        bind(PlaceManager.class).to(AppPlaceManager.class).asEagerSingleton();

        bindPresenter(AppPresenter.class, AppPresenter.Display.class, AppView.class);
        bindPresenter(HeaderPresenter.class, HeaderPresenter.Display.class, HeaderView.class);
        bindPresenter(MainPresenter.class, MainPresenter.Display.class, MainView.class);
        bindPresenter(NavigationPresenter.class, NavigationPresenter.Display.class, NavigationView.class);
        bindPresenter(ChannelsPresenter.class, ChannelsPresenter.Display.class, ChannelsView.class);
        bindPresenter(EditChannelPresenter.class, EditChannelPresenter.Display.class, EditChannelView.class);
        bindPresenter(ArticlesPresenter.class, ArticlesPresenter.Display.class, ArticlesView.class);
        bindPresenter(EditArticlePresenter.class, EditArticlePresenter.Display.class, EditArticleView.class);
        bindPresenter(AttachmentsPresenter.class, AttachmentsPresenter.Display.class, AttachmentsView.class);
        bindPresenter(EditAttachmentPresenter.class, EditAttachmentPresenter.Display.class, EditAttachmentView.class);
        bindPresenter(SettingsPresenter.class, SettingsPresenter.Display.class, SettingsView.class);

        bind(ArticleProxy.class);
        bind(AttachmentProxy.class);
    }

}
